efform_onload = function ()
{
	efgrid.submitInqu( "ef_grid_r", "ZM","ZMCN20","query");
}; 

button_query_onclick = function () 
{   	
	efgrid.submitInqu( "ef_grid_r", "ZM","ZMCN20","query");
}
button_update_onclick = function (){ 
	var grid=isSelected("ef_grid_r");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		if(grid.getCellValueByColumnName(rows[i],"fdStatus")!="草拟")
		{
			EFAlert("只能修改草拟状态的记录！"); return;
		}
	}
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCN20","update",true);
}
button_insert_onclick = function (){
	if (isSelected("ef_grid_r") == 0)return; 
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCN20","insert",true);
} 
button_delete_onclick = function (){
	var grid=isSelected("ef_grid_r");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		if(grid.getCellValueByColumnName(rows[i],"fdStatus")!="草拟")
		{
			EFAlert("只能删除草拟状态的记录！"); return;
		}
	}
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r){
			efgrid.submitForm( "ef_grid_r", "ZM","ZMCN20","delete",true);
/*			var info = getSCZXEiInfos("ZMCN10","ef_grid_r");
			if (null != info) { 
				EiCommunicator.send("ZMCN10", "validate1", info, validate1_callback);
			}*/
		}
	}); 
}
button_report_onclick = function (){
	var grid=isSelected("ef_grid_r");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		if(grid.getCellValueByColumnName(rows[i],"fdStatus")!="草拟")
		{
			EFAlert("该记录或有记录已经生效！"); return;
		}
	}
	EFConfirm('你确认要生效吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_r", "ZM","ZMCN20","report",true);
	}); 
}
efgrid_afterAddNewRow = function(grid_id){ 
	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();  
	if(grid_id=="ef_grid_r")
	{
		for(var i = 0 ; i < rows.length;i++){
			grid.getBlockData().setCell(rows[i], "fdStatus", "草拟");		
            grid.getBlockData().setCell(rows[i],"fdKeyId","")
		}
	}
}
